package opengles;

import android.opengl.GLES20;

/**
 * Created by freehyan on 9/7/2016.
 */
public class GLESProgram {
    private int mProgram;

    public void compileShader(int vertexShader, int fragmentShader){
        mProgram = GLES20.glCreateProgram();
        GLES20.glAttachShader(mProgram, vertexShader);
        GLES20.glAttachShader(mProgram, fragmentShader);
        GLES20.glLinkProgram(mProgram);
    }

    public int loadShader(int type, String shaderCode){
        int shader = GLES20.glCreateShader(type);
        GLES20.glShaderSource(shader, shaderCode);
        GLES20.glCompileShader(shader);
        return shader;
    }

    public int getProgram() {
        return mProgram;
    }
}
